#43 new
Jaime Bellmyer

login_as only accepts a fixture symbol

Reported by Jaime Bellmyer | February 14th, 2009 @ 02:33 PM

I tend to favor factories and datasets over fixtures, but getting rid of the user fixtures generally means a lot of work in the boilerplate restful_auth tests.

As one step in the right direction, I made a small tweak to login_as. If you pass a user model (or whatever model you chose to authenticate) it will use that instead of looking for a fixture. I've attached the git diff patch to this ticket.

This makes divorcing fixtures in restful_auth possible. I've also thought about making it downright pleasant by modifying the TestUnit functional tests to be more fixture-agnostic. My first thought is to limit the fixture calls (ie, users(:quentin) down to just once in the setup method. That way, a developer could change:

def setup @user = users(:quentin) end


def setup @user = Factory.create(:user) end

at the top of tests and most, if not all, of the change is done. Feedback on this idea would be appreciated.

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Restful Authentication Generator

This widely-used plugin provides a foundation for securely managing user
* Login / logout
* Secure password handling
* Account activation by validating email
* Account approval / disabling by admin
* Rudimentary hooks for authorization and access control.


People watching this ticket